var t = getApp();

Page({
    data: {
        active: 0,
        list: [],
        not_settlement_statistic: 0,
        already_settlement_statistic: 0,
        current_page: 1,
        last_page: 1
    },
    change: function(a) {
        var e = this;
        this.setData({
            active: a.detail.index
        });
        var s = {};
        0 !== this.data.active && (s.status = 1 == this.data.active ? 0 : 1), t._getNetWork({
            url: t.getNetAddresss("plugin.sign-buy.frontend.asset-record.stock-record"),
            data: s,
            success: function(a) {
                var s = a.data, n = s.result, i = s.msg, r = s.data;
                if (0 == n) return t.tips(i);
                e.setData({
                    list: r.data,
                    current_page: r.current_page,
                    last_page: r.last_page
                });
            }
        });
    },
    getData: function() {
        var a = this;
        t._getNetWork({
            url: t.getNetAddresss("plugin.sign-buy.frontend.asset-record.stock"),
            success: function(e) {
                var s = e.data, n = s.result, i = s.msg, r = s.data, c = r.already_settlement_statistic, d = r.not_settlement_statistic;
                if (0 == n) return t.tips(i);
                a.setData({
                    already_settlement_statistic: c,
                    not_settlement_statistic: d
                });
            }
        });
    },
    _getDetail: function() {
        var a = this, e = {};
        0 !== this.data.active && (e.status = 1 == this.data.active ? 0 : 1), t._getNetWork({
            url: t.getNetAddresss("plugin.sign-buy.frontend.asset-record.stock-record"),
            data: e,
            success: function(e) {
                var s = e.data, n = s.result, i = s.msg, r = s.data;
                if (0 == n) return t.tips(i);
                a.setData({
                    list: r.data,
                    current_page: r.current_page,
                    last_page: r.last_page
                });
            }
        });
    },
    onLoad: function(t) {
        this.getData(), this._getDetail();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        var a = this;
        if (!(this.data.current_page >= this.data.last_page)) {
            var e = {};
            e.page = this.current_page + 1, 0 !== this.data.active && (e.status = this.data.active), 
            t._getNetWork({
                url: t.getNetAddresss("plugin.sign-buy.frontend.asset-record.stock-record"),
                data: e,
                success: function(e) {
                    var s = e.data, n = s.result, i = s.msg, r = s.data;
                    if (0 == n) return t.tips(i);
                    var c = a.data.list.concat(r.data);
                    a.setData({
                        list: c,
                        current_page: dataa.current_page,
                        last_page: r.last_page
                    });
                }
            });
        }
    },
    onShareAppMessage: function() {}
});